@echo off
chcp 65001
echo ========================================
echo    ELM Microservice Docker Deployment
echo ========================================
echo.

echo [1/4] Checking Docker environment...
docker --version >nul 2>&1
if errorlevel 1 (
    echo ERROR: Docker is not installed!
    pause
    exit /b 1
)
echo ✓ Docker is available

docker-compose --version >nul 2>&1
if errorlevel 1 (
    echo ERROR: Docker Compose is not installed!
    pause
    exit /b 1
)
echo ✓ Docker Compose is available
echo.

echo [2/4] Stopping existing containers...
docker-compose down
echo ✓ Containers stopped
echo.

echo [3/4] Building and starting services...
echo This may take several minutes for the first time...
docker-compose up --build -d
echo ✓ Services started
echo.

echo [4/4] Checking service status...
timeout /t 10 /nobreak >nul
docker-compose ps
echo.

echo ========================================
echo           DEPLOYMENT COMPLETED
echo ========================================
echo.
echo Service URLs:
echo • Eureka Registry: http://localhost:18000
echo • Gateway:         http://localhost:12000
echo • User Service:    http://localhost:8000
echo • MySQL Database:  localhost:3306
echo.
echo Management Commands:
echo • View logs:       docker-compose logs -f
echo • Stop services:   docker-compose down
echo • Restart:         docker-compose restart
echo.
pause 